package com.bjpowernode.crm.web.controller;

import com.bjpowernode.crm.pojo.Page;
import com.bjpowernode.crm.pojo.Trans;
import com.bjpowernode.crm.service.CustomerService;
import com.bjpowernode.crm.service.TransService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Controller
@ResponseBody
@RequestMapping("trans")
public class TransController {
    @Resource
    private TransService transService;

    @Resource
    private CustomerService customerService;

    @RequestMapping("list.json")
    public Page getTrans(Page page, @RequestParam Map map){
        System.out.println(map);
        transService.getTrans(page,map);
        return page;
    }

    @RequestMapping("listDetail.json")
    public Trans listDetail(String id){
       Trans trans = transService.getAll(id);
       return trans;
    }

    @RequestMapping("getCustomerName.do")
    public List<String> getCustomerName(String name){
        return customerService.getCustomerName(name);
    }
}
